package com.xy.biz.fd.controller;

import com.xy.biz.fd.domain.req.GetPdfRequest;
import com.xy.biz.fd.service.DocumentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.io.*;

/**
 * @author 于振晗
 * @title: DocumentPDFController
 * @date 2021年06月18日
 * @path com.xy.biz.fd.controller
 */

@Api(tags = "文档服务")
@Slf4j
@Controller
@RequestMapping("/api/fd/pdf")
public class DocumentPDFController {


    @Autowired
    private DocumentService documentService;

    @Autowired
    private HttpServletResponse response;

    @ApiOperation(value = "查看图片类型文档")
    @GetMapping(value = "/get_document_by_pdf")
    public void getDocumentByPdf(@RequestParam("documentId") Long documentId) {
        documentService.getDocumentByPdf(documentId, response);
    }

}
